package com.cx.controller;

import com.cx.pojo.User;
import com.cx.service.impl.Service;
import com.netflix.ribbon.proxy.annotation.Http;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@RestController
public class ServerTest {
    @Autowired
    Service service;
    @RequestMapping("t1")
    public User t1(String name, Integer age){
        return service.test(name,age);
    }
    @RequestMapping("t2")
    public User t2(HttpServletRequest httpServletRequest){
        HttpSession httpSession = httpServletRequest.getSession();
        return (User) httpSession.getAttribute("user");
    }
}
